using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

//有这行生成的脚本都是UTF-8形式的
namespace MyGame
{
    public class MyButton : MonoBehaviour, IPointerEnterHandler,IPointerExitHandler,IPointerClickHandler
    {
        private Image MyImage;

        public Image myImage 
        {
             get { return MyImage; }
             set { MyImage = value;}
        }

        public Action myAction_Click;
        public Action myAction_Enter;
        public Action myAction_Exit;

        private void Awake()
        {
            MyImage = GetComponent<Image>();
        }

        private void OnEnable()
        {
            if (transform.localScale != Vector3.one)
            {
                transform.localScale = Vector3.one;
            }
        }

        public void OnPointerClick(PointerEventData eventData)
        {
            myAction_Click?.Invoke();
        }

        public void OnPointerEnter(PointerEventData eventData)
        {
            myAction_Enter?.Invoke();
        }

        public void OnPointerExit(PointerEventData eventData)
        {
            myAction_Exit?.Invoke();
        }
    }
}

